package file.day9_16.homework;

import java.io.File;
import java.io.FileFilter;

public class Test2 {
    public static void main(String[] args) {
        FileFilter filter = new FileFilter() {
            public boolean accept(File file) {
                return file.getName().contains("s");
            }
        };
        File dir = new File("./");
        if(dir.isDirectory()){
            File[] subs = dir.listFiles(filter);//使用listFiles方法接受传入的筛选器，并将dir内的文件进行筛选
            for (File file : subs){
                System.out.println(file.getName());
            }
        }
    }
}
